/**
 * <copyright>
 * </copyright>
 *
 */
package lco.cRLanguage.impl;

import lco.cRLanguage.AssignmentRightHand;
import lco.cRLanguage.CRLanguagePackage;
import lco.cRLanguage.Callable;
import lco.cRLanguage.File;
import lco.cRLanguage.IndexedVectorial;
import lco.cRLanguage.Variable;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Assignment Right Hand</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link lco.cRLanguage.impl.AssignmentRightHandImpl#getInteger <em>Integer</em>}</li>
 *   <li>{@link lco.cRLanguage.impl.AssignmentRightHandImpl#getDouble <em>Double</em>}</li>
 *   <li>{@link lco.cRLanguage.impl.AssignmentRightHandImpl#getFile <em>File</em>}</li>
 *   <li>{@link lco.cRLanguage.impl.AssignmentRightHandImpl#getVariable <em>Variable</em>}</li>
 *   <li>{@link lco.cRLanguage.impl.AssignmentRightHandImpl#getIndexedVectorial <em>Indexed Vectorial</em>}</li>
 *   <li>{@link lco.cRLanguage.impl.AssignmentRightHandImpl#getCallable <em>Callable</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AssignmentRightHandImpl extends MinimalEObjectImpl.Container implements AssignmentRightHand
{
  /**
   * The default value of the '{@link #getInteger() <em>Integer</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInteger()
   * @generated
   * @ordered
   */
  protected static final int INTEGER_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getInteger() <em>Integer</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getInteger()
   * @generated
   * @ordered
   */
  protected int integer = INTEGER_EDEFAULT;

  /**
   * The default value of the '{@link #getDouble() <em>Double</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDouble()
   * @generated
   * @ordered
   */
  protected static final String DOUBLE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getDouble() <em>Double</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDouble()
   * @generated
   * @ordered
   */
  protected String double_ = DOUBLE_EDEFAULT;

  /**
   * The cached value of the '{@link #getFile() <em>File</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFile()
   * @generated
   * @ordered
   */
  protected File file;

  /**
   * The cached value of the '{@link #getVariable() <em>Variable</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getVariable()
   * @generated
   * @ordered
   */
  protected Variable variable;

  /**
   * The cached value of the '{@link #getIndexedVectorial() <em>Indexed Vectorial</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIndexedVectorial()
   * @generated
   * @ordered
   */
  protected IndexedVectorial indexedVectorial;

  /**
   * The cached value of the '{@link #getCallable() <em>Callable</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getCallable()
   * @generated
   * @ordered
   */
  protected Callable callable;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected AssignmentRightHandImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return CRLanguagePackage.Literals.ASSIGNMENT_RIGHT_HAND;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getInteger()
  {
    return integer;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setInteger(int newInteger)
  {
    int oldInteger = integer;
    integer = newInteger;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INTEGER, oldInteger, integer));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getDouble()
  {
    return double_;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDouble(String newDouble)
  {
    String oldDouble = double_;
    double_ = newDouble;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__DOUBLE, oldDouble, double_));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public File getFile()
  {
    return file;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetFile(File newFile, NotificationChain msgs)
  {
    File oldFile = file;
    file = newFile;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__FILE, oldFile, newFile);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setFile(File newFile)
  {
    if (newFile != file)
    {
      NotificationChain msgs = null;
      if (file != null)
        msgs = ((InternalEObject)file).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__FILE, null, msgs);
      if (newFile != null)
        msgs = ((InternalEObject)newFile).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__FILE, null, msgs);
      msgs = basicSetFile(newFile, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__FILE, newFile, newFile));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Variable getVariable()
  {
    if (variable != null && variable.eIsProxy())
    {
      InternalEObject oldVariable = (InternalEObject)variable;
      variable = (Variable)eResolveProxy(oldVariable);
      if (variable != oldVariable)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__VARIABLE, oldVariable, variable));
      }
    }
    return variable;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Variable basicGetVariable()
  {
    return variable;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setVariable(Variable newVariable)
  {
    Variable oldVariable = variable;
    variable = newVariable;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__VARIABLE, oldVariable, variable));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public IndexedVectorial getIndexedVectorial()
  {
    return indexedVectorial;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetIndexedVectorial(IndexedVectorial newIndexedVectorial, NotificationChain msgs)
  {
    IndexedVectorial oldIndexedVectorial = indexedVectorial;
    indexedVectorial = newIndexedVectorial;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INDEXED_VECTORIAL, oldIndexedVectorial, newIndexedVectorial);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setIndexedVectorial(IndexedVectorial newIndexedVectorial)
  {
    if (newIndexedVectorial != indexedVectorial)
    {
      NotificationChain msgs = null;
      if (indexedVectorial != null)
        msgs = ((InternalEObject)indexedVectorial).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INDEXED_VECTORIAL, null, msgs);
      if (newIndexedVectorial != null)
        msgs = ((InternalEObject)newIndexedVectorial).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INDEXED_VECTORIAL, null, msgs);
      msgs = basicSetIndexedVectorial(newIndexedVectorial, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INDEXED_VECTORIAL, newIndexedVectorial, newIndexedVectorial));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Callable getCallable()
  {
    return callable;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetCallable(Callable newCallable, NotificationChain msgs)
  {
    Callable oldCallable = callable;
    callable = newCallable;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__CALLABLE, oldCallable, newCallable);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setCallable(Callable newCallable)
  {
    if (newCallable != callable)
    {
      NotificationChain msgs = null;
      if (callable != null)
        msgs = ((InternalEObject)callable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__CALLABLE, null, msgs);
      if (newCallable != null)
        msgs = ((InternalEObject)newCallable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__CALLABLE, null, msgs);
      msgs = basicSetCallable(newCallable, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__CALLABLE, newCallable, newCallable));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__FILE:
        return basicSetFile(null, msgs);
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INDEXED_VECTORIAL:
        return basicSetIndexedVectorial(null, msgs);
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__CALLABLE:
        return basicSetCallable(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INTEGER:
        return getInteger();
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__DOUBLE:
        return getDouble();
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__FILE:
        return getFile();
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__VARIABLE:
        if (resolve) return getVariable();
        return basicGetVariable();
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INDEXED_VECTORIAL:
        return getIndexedVectorial();
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__CALLABLE:
        return getCallable();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INTEGER:
        setInteger((Integer)newValue);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__DOUBLE:
        setDouble((String)newValue);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__FILE:
        setFile((File)newValue);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__VARIABLE:
        setVariable((Variable)newValue);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INDEXED_VECTORIAL:
        setIndexedVectorial((IndexedVectorial)newValue);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__CALLABLE:
        setCallable((Callable)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INTEGER:
        setInteger(INTEGER_EDEFAULT);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__DOUBLE:
        setDouble(DOUBLE_EDEFAULT);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__FILE:
        setFile((File)null);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__VARIABLE:
        setVariable((Variable)null);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INDEXED_VECTORIAL:
        setIndexedVectorial((IndexedVectorial)null);
        return;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__CALLABLE:
        setCallable((Callable)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INTEGER:
        return integer != INTEGER_EDEFAULT;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__DOUBLE:
        return DOUBLE_EDEFAULT == null ? double_ != null : !DOUBLE_EDEFAULT.equals(double_);
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__FILE:
        return file != null;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__VARIABLE:
        return variable != null;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__INDEXED_VECTORIAL:
        return indexedVectorial != null;
      case CRLanguagePackage.ASSIGNMENT_RIGHT_HAND__CALLABLE:
        return callable != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (integer: ");
    result.append(integer);
    result.append(", double: ");
    result.append(double_);
    result.append(')');
    return result.toString();
  }

} //AssignmentRightHandImpl
